#!/usr/bin/env python
#coding=utf-8
#1/3切分数据
#读源数据
from config import TRAINING_FILE,RUN_TRAINING_FILE,TEST_TRAINING_FILE

if __name__ == "__main__":
    file = open( TRAINING_FILE ,"r" )
    file_run = open( RUN_TRAINING_FILE,"w" )    #建立结果文件
    file_test = open( TEST_TRAINING_FILE,"w" )
    
    lines = file.readlines()
    #写一行item名称
    file_run.write(lines[0])
    file_test.write(lines[0])
    
    for i in range(1,len(lines)):        
        if int(i%3) != 0:
            file_run.write(lines[i])
        else:
            file_test.write(lines[i])
    print "Split finished!"
